/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import dao.CuaHangDAO;
import dao.KhachHangDAO;
import dao.QuiDinhDAO;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import pojo.CuaHang;
import pojo.KhachHang;
import pojo.QuyDinh;

/**
 *
 * @author Phi
 */
public class QuanLyKhachHang extends javax.swing.JInternalFrame {

    /**
     * Creates new form QuanLyKhachHang
     */
    public QuanLyKhachHang() {
        initComponents();
    }
    
    public void XemDanhSachKhachHang() throws Exception{
        DefaultTableModel dtm=new DefaultTableModel();
        dtm.addColumn("Ma Khach Hang");
        dtm.addColumn("Ho Ten Khach Hang");
        dtm.addColumn("Dien Thoai");
        dtm.addColumn("Dia Chi");
        dtm.addColumn("Email");
        dtm.addColumn("Tien No");
        dtm.addColumn("Ma Cua Hang");
        List<KhachHang> ds=KhachHangDAO.layDanhSachKhachHang();
        dtm.setRowCount(ds.size());
        for(int i=0;i<ds.size();i++){
            KhachHang kh=ds.get(i);
            dtm.setValueAt(kh.getMaKhachHang(), i, 0);
            dtm.setValueAt(kh.getHoTenKhachHang(), i,1);
            dtm.setValueAt(kh.getDienThoai(), i, 2);
            dtm.setValueAt(kh.getDiaChi(), i,3);
            dtm.setValueAt(kh.getEmail(), i,4);
            dtm.setValueAt(kh.getTienNo(), i,5);
            dtm.setValueAt(kh.getCuaHang().getMaCuaHang(), i, 6);
        }
        this.jtbQuanLyKH.setModel(dtm);
    }
    
    public void them() throws Exception{
        String hoTen=this.jtfHoTen.getText();
        
        String dienThoai=this.jtfDienThoai.getText();//        
        String diaChi=this.jtfDiaChi.getText();      
        String email=this.jtfEmail.getText();       
        String tienNo=this.jtfTienNo.getText();
        double tn=Double.parseDouble(tienNo);
        
        KhachHang kh=new KhachHang();
        CuaHang ch=new CuaHang();
        Vector ma=new Vector();
        ma=(Vector) this.jcbKhachHang.getSelectedItem();
        int mach=(Integer)ma.get(0);
        ch=CuaHangDAO.layThongTinCuaHang(mach);
        kh.setCuaHang(ch);
        kh.setHoTenKhachHang(hoTen);
        kh.setDienThoai(dienThoai);
        kh.setDiaChi(diaChi);
        kh.setEmail(email);
        kh.setTienNo(tn);
        boolean kq=KhachHangDAO.themThongTinKhachHang(kh);
        if(kq==false){
            JOptionPane.showMessageDialog(this,"Thêm thất bại ");         
        }
        else 
            JOptionPane.showMessageDialog(this,"Thêm thành công");
            this.XemDanhSachKhachHang();
    }
    
    
    public void xoa() throws Exception{
        int dong=this.jtbQuanLyKH.getSelectedRow();
        int maKhachHang=(Integer) this.jtbQuanLyKH.getValueAt(dong, 0);
        boolean kq=KhachHangDAO.xoaKhachHang(maKhachHang);
        if(kq==false){
            JOptionPane.showMessageDialog(this,"Xoá thất bại ");         
        }
        else 
            JOptionPane.showMessageDialog(this,"Xoá thành công");
            this.XemDanhSachKhachHang();
    }
    
    public void xoa_capnhat() throws Exception{
        int dong=this.jtbQuanLyKH.getSelectedRow();
        int maKhachHang=(Integer) this.jtbQuanLyKH.getValueAt(dong, 0);
        boolean kq=KhachHangDAO.xoaKhachHang(maKhachHang);
    }
    
    
     public void them_capnhat() throws Exception{
        String hoTen=this.jtfHoTen.getText();
        
        String dienThoai=this.jtfDienThoai.getText();//        
        String diaChi=this.jtfDiaChi.getText();      
        String email=this.jtfEmail.getText();       
        String tienNo=this.jtfTienNo.getText();
        double tn=Double.parseDouble(tienNo);
        
        KhachHang kh=new KhachHang();
        CuaHang ch=new CuaHang();
        Vector ma=new Vector();
        ma=(Vector) this.jcbKhachHang.getSelectedItem();
        int mach=(Integer)ma.get(0);
        ch=CuaHangDAO.layThongTinCuaHang(mach);
        kh.setCuaHang(ch);
        kh.setHoTenKhachHang(hoTen);
        kh.setDienThoai(dienThoai);
        kh.setDiaChi(diaChi);
        kh.setEmail(email);
        kh.setTienNo(tn);
        boolean kq=KhachHangDAO.themThongTinKhachHang(kh);
        if(kq==false){
            JOptionPane.showMessageDialog(this,"Cập nhật thất bại ");         
        }
        else 
            JOptionPane.showMessageDialog(this,"Cập nhật thành công");
            this.XemDanhSachKhachHang();
    }
    
     public void timKiem(){
          try {                    
            Vector vt=new Vector();
            vt = (Vector) this.jcbKhachHang.getSelectedItem();
            int maCuaHang = (Integer) vt.get(0);
            String hoTenKhachHang = this.jtfHoTen.getText();
            List<KhachHang> ds=KhachHangDAO.timKhachHang(hoTenKhachHang,maCuaHang);
            DefaultTableModel dtm = new DefaultTableModel();
            dtm.addColumn("Ma khach hang");
            dtm.addColumn("Ten khach hang");
            dtm.addColumn("Đien thoai");
            dtm.addColumn("Đia chi");
            dtm.addColumn("Email");
            dtm.addColumn("Tien no");
            dtm.addColumn("Ma cua hang");
            //dtm.setRowCount(ds.size());
            for(int i=0;i<ds.size();i++){
            KhachHang kh=ds.get(i);
            Vector vt1 = new Vector();
            vt1.add(kh.getMaKhachHang());
            vt1.add(kh.getHoTenKhachHang());
            vt1.add(kh.getDienThoai());
            vt1.add(kh.getDiaChi());
            vt1.add(kh.getEmail());
            vt1.add(kh.getTienNo());
            vt1.add(kh.getCuaHang().getMaCuaHang());
            dtm.addRow(vt1);
        }
            this.jtbQuanLyKH.setModel(dtm);
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
     }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jbtCapNhat = new javax.swing.JButton();
        jbtThem = new javax.swing.JButton();
        jbtXoa = new javax.swing.JButton();
        jbtTimKiem = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jtfHoTen = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jtfEmail = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jtfDienThoai = new javax.swing.JTextField();
        jtfTienNo = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jcbKhachHang = new javax.swing.JComboBox();
        jtfDiaChi = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtbQuanLyKH = new javax.swing.JTable();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setTitle("Quản Lý Khách Hàng");
        addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
            public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
                formInternalFrameOpened(evt);
            }
        });

        jbtCapNhat.setText("Cập Nhật");
        jbtCapNhat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtCapNhatActionPerformed(evt);
            }
        });

        jbtThem.setText("Thêm");
        jbtThem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtThemActionPerformed(evt);
            }
        });

        jbtXoa.setText("Xóa");
        jbtXoa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtXoaActionPerformed(evt);
            }
        });

        jbtTimKiem.setText("Tìm Kiếm");
        jbtTimKiem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtTimKiemActionPerformed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Thông tin khách hàng"));

        jLabel1.setText("Họ Tên");

        jtfHoTen.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                jtfHoTenCaretUpdate(evt);
            }
        });
        jtfHoTen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtfHoTenActionPerformed(evt);
            }
        });

        jLabel4.setText("Email");

        jLabel2.setText("Điện Thoại");

        jLabel5.setText("Tiền Nợ");

        jtfDienThoai.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtfDienThoaiActionPerformed(evt);
            }
        });

        jLabel3.setText("Địa Chỉ");

        jcbKhachHang.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbKhachHangActionPerformed(evt);
            }
        });

        jLabel6.setText("Cửa hàng");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel4))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jtfEmail, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
                    .addComponent(jtfHoTen))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jtfDienThoai, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE)
                    .addComponent(jtfTienNo))
                .addGap(45, 45, 45)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel6))
                .addGap(45, 45, 45)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jcbKhachHang, 0, 116, Short.MAX_VALUE)
                    .addComponent(jtfDiaChi))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jtfHoTen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(jtfDienThoai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(jtfDiaChi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jtfEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jtfTienNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcbKhachHang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(28, 28, 28))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Danh sách khách hàng"));

        jtbQuanLyKH.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jtbQuanLyKH.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jtbQuanLyKHMouseClicked(evt);
            }
        });
        jtbQuanLyKH.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                jtbQuanLyKHAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });
        jScrollPane1.setViewportView(jtbQuanLyKH);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 711, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jbtThem, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtXoa, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtCapNhat)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtTimKiem)
                        .addGap(109, 109, 109))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtXoa)
                    .addComponent(jbtThem)
                    .addComponent(jbtTimKiem)
                    .addComponent(jbtCapNhat))
                .addGap(1214, 1214, 1214))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-749)/2, (screenSize.height-378)/2, 749, 378);
    }// </editor-fold>//GEN-END:initComponents

    private void jbtThemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtThemActionPerformed
        try {
            this.them();
        } catch (Exception ex) {
            Logger.getLogger(QuanLyKhachHang.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jbtThemActionPerformed

    private void jtfHoTenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtfHoTenActionPerformed
      
    }//GEN-LAST:event_jtfHoTenActionPerformed

    private void jtfDienThoaiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtfDienThoaiActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtfDienThoaiActionPerformed

    private void jtbQuanLyKHAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jtbQuanLyKHAncestorAdded
        try {
            this.XemDanhSachKhachHang();
        } catch (Exception ex) {
            Logger.getLogger(QuanLyKhachHang.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jtbQuanLyKHAncestorAdded

    private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened
        try {
            DefaultComboBoxModel dcbm=new DefaultComboBoxModel();
            List<CuaHang> ds=CuaHangDAO.layDanhSachCuaHang();
            for(int i=0; i<ds.size(); i++){ 
                CuaHang ch=ds.get(i); 
                Vector vt = new Vector();
                vt.add(ch.getMaCuaHang());
                vt.add(ch.getTenCuaHang());
                dcbm.addElement(vt);
            }
            this.jcbKhachHang.setModel(dcbm);
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_formInternalFrameOpened

    private void jbtXoaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtXoaActionPerformed
        try {
            this.xoa();
        } catch (Exception ex) {
            Logger.getLogger(QuanLyKhachHang.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jbtXoaActionPerformed

    private void jtbQuanLyKHMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtbQuanLyKHMouseClicked
        int dong =this.jtbQuanLyKH.getSelectedRow();
        String maKH=this.jtbQuanLyKH.getValueAt(dong, 1).toString();
        String dienThoai=this.jtbQuanLyKH.getValueAt(dong, 2).toString();
        String diaChi=this.jtbQuanLyKH.getValueAt(dong, 3).toString();
        String email=this.jtbQuanLyKH.getValueAt(dong, 4).toString();
        String tienNo=this.jtbQuanLyKH.getValueAt(dong, 5).toString();
        this.jtfHoTen.setText(maKH);
        this.jtfDienThoai.setText(dienThoai);
        this.jtfDiaChi.setText(diaChi);
        this.jtfEmail.setText(email);
        this.jtfTienNo.setText(tienNo);
    }//GEN-LAST:event_jtbQuanLyKHMouseClicked

    private void jbtCapNhatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtCapNhatActionPerformed
        try {
            this.xoa_capnhat();
        } catch (Exception ex) {
            Logger.getLogger(QuanLyKhachHang.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            this.them_capnhat();
        } catch (Exception ex) {
            Logger.getLogger(QuanLyKhachHang.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jbtCapNhatActionPerformed

    private void jbtTimKiemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtTimKiemActionPerformed
        this.timKiem();
    }//GEN-LAST:event_jbtTimKiemActionPerformed

    private void jcbKhachHangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbKhachHangActionPerformed
       this.timKiem();
    }//GEN-LAST:event_jcbKhachHangActionPerformed

    private void jtfHoTenCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_jtfHoTenCaretUpdate
        //this.timKiem();
    }//GEN-LAST:event_jtfHoTenCaretUpdate

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton jbtCapNhat;
    private javax.swing.JButton jbtThem;
    private javax.swing.JButton jbtTimKiem;
    private javax.swing.JButton jbtXoa;
    private javax.swing.JComboBox jcbKhachHang;
    private javax.swing.JTable jtbQuanLyKH;
    private javax.swing.JTextField jtfDiaChi;
    private javax.swing.JTextField jtfDienThoai;
    private javax.swing.JTextField jtfEmail;
    private javax.swing.JTextField jtfHoTen;
    private javax.swing.JTextField jtfTienNo;
    // End of variables declaration//GEN-END:variables
}
